<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:define name="title">
        <h:outputText value="#{bundle.CreatecurrentTitle}"></h:outputText>
    </ui:define>
    <ui:define name="body">
        <h:form id="form" styleClass="form list">
            <p:fieldset id="current"  legend="Project Details"  >
                <p:focus/>
                <h:panelGrid columns="2" columnClasses="label,field" styleClass="form_list">
                    <h:outputLabel value="Project Name:" for="prjName" />
                    <p:inputText id="prjName" value="#{projectController.current.prjName}" title="Project Name" required="true" requiredMessage="Project Name is Required"/>
                    <h:outputLabel value="Project Description:" for="prjDesc" />
                    <p:inputText id="prjDesc" value="#{projectController.current.prjDesc}" title="Project Description" required="true" requiredMessage="Project Description is Required"/>
                    <h:outputLabel value="Coordinator:" for="coordId" />
                    <c:choose>
                        <c:when test="#{userController.allowedGroups('1')}">
                            <p:selectOneMenu id="coordId" value="#{projectController.current.createdBy}" required="true" rendered="#{not empty userController.users}"  effect="fade" label="Coordinator" >
                                <f:selectItem itemLabel="Select One" itemValue=""  />
                                <f:selectItems value="#{userController.users}" var="user" itemLabel="#{user.userLogin}" itemValue="#{user}"  transient="true"  />
                            </p:selectOneMenu>
                            <h:outputLabel value="#{userController.loggedUser.userLogin}"  rendered="#{empty userController.users}" >
                                <c:set target="#{projectController.current}" property="createdBy" value="#{userController.loggedUser}"/>
                            </h:outputLabel>
                        </c:when>
                        <c:otherwise>
                            <h:outputLabel value="#{userController.loggedUser.userLogin}" >
                                <c:set target="#{projectController.current}" property="createdBy" value="#{userController.loggedUser}"/>
                            </h:outputLabel>
                        </c:otherwise>
                    </c:choose>
                </h:panelGrid>  <br/>
                <p:commandButton ajax="false" action="#{projectController.create}" value="#{bundle.CreateProjectSaveLink}" process="@form" update="@form" />
                <p:commandButton ajax="false" action="#{projectController.prepareList}" value="Show All" immediate="true"/>
            </p:fieldset>
        </h:form>
    </ui:define>
</ui:composition>


